$(".mybody-leftOne").click(function() {
	window.location.href = '学生信息管理.html'
})

$(".mybody-leftTwo").click(function() {
	window.location.href = '学生成绩管理.html'
})

$(".mybody-leftThree").click(function() {
	window.location.href = '科目信息.html'
})

//科目下拉框焦点判断
$("select").change(function() {
	let course1 = $("select option:selected").text()
	// console.log(course1)
	if (course1 == "请选择") {
		$(".yanzheng1 .yes").hide(100)
		$(".yanzheng1 .no").show(100)

	} else {
		$(".yanzheng1 .no").hide(100)
		$(".yanzheng1 .yes").show(100)
	}
})
//任课老师框焦点判断
$("#user1").bind('input propertychange', function() {
	// console.log($("#user1").val())
	let student_number1 = $("#user1").val()
	if (student_number1 == "") {

		$(".yanzheng2 .yes").hide(100)
		$(".yanzheng2 .no").show(100)

	} else {
		$(".yanzheng2 .no").hide(100)
		$(".yanzheng2 .yes").show(100)
	}
})
//科目简介框焦点判断
$("#user2").bind('input propertychange', function() {
	// console.log($("#user1").val())
	let term1 = $("#user2").val()
	if (term1 == "") {

		$(".yanzheng3 .yes").hide(100)
		$(".yanzheng3 .no").show(100)

	} else {
		$(".yanzheng3 .no").hide(100)
		$(".yanzheng3 .yes").show(100)
	}
})
var ast1 = ""

function ted() {
	ast1 = $("select option:selected").text()
}


$(".but_5").click(function() {
	var teacher1 = $("#user1").val()
	var content1 = $("#user2").val()
	if (ast1 == "" || ast1 == "请选择") {
		alert("请选择科目信息")
	}else if (teacher1 == '') {
		alert("请输入任课老师")
	} else if (content1 == '') {
		alert("请输入科目简介")
	} else {
		$.ajax({
			url: "http://student.qhynice.top/j_addcourse.php",
			type: "get",
			data: {
				"course": ast1,
				"teacher": teacher1,
				"content": content1,
			},
			dataType: "json",
			success: function(data) {
				console.log(data)
				if (data.status == 1) {
					alert('增加信息成功')
					window.location.href = "科目信息.html"
				} else {
					alert('增加信息失败')
				}
			}
		})
	}
})
